package com.vcms.controller.customer.states;

import com.vcms.controller.customer.TransactionController;

public class StateFactory {
	private static StateFactory instance = null;
	
	public static StateFactory getInstance(){
		if(instance == null){
			instance = new StateFactory();
		}
		
		return instance;
	}
	
	private StateFactory(){
		
	}
	
	public TransactionState create(int type, TransactionController transactionController){
		TransactionState transactionState = null;
		
		switch(type){
		case TransactionState.COININPUT:
			transactionState = new CoinInputState(transactionController);
			break;
		case TransactionState.DISPENSEDRINK:
			transactionState = new DispenseDrinkState(transactionController);
			break;
		case TransactionState.FAULT:
			transactionState = new FaultState(transactionController);
			break;
		case TransactionState.INITIAL:
			transactionState = new InitialState(transactionController);
			break;
		case TransactionState.MAINTENANCE:
			transactionState = new MaintenanceState(transactionController);
			break;
		case TransactionState.READY:
			transactionState = new ReadyState(transactionController);
			break;
		case TransactionState.TERMINATE:
			transactionState = new TerminateState(transactionController);
			break;
		default:
			transactionState = null;
		}
		
		return transactionState;
	}
}
